package com.youkeda.yunmusic.web.control;

import com.youkeda.yunmusic.web.model.Comment;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.List;

@Controller
public class CommentControl {

//    @Autowired
//    private CommentPostControl commentPostControl;
    @RequestMapping(path = "/comments")
    public String comments(ModelMap modelMap){
        CommentPostControl commentPostControl = new CommentPostControl();
        List<Comment> comments = commentPostControl.getComments("35847388");
        if(comments.get(0).getNickName()==null){
            comments.remove(0);
        }
        modelMap.addAttribute("comments",comments);
        return "comments";
    }
//    //初始化评论
//    private List getComments(){
//        List<Comment> comments = new ArrayList<>();
//        Comment comment = new Comment();
//        comment.setIcon("https://p1.music.126.net/HKDERL3e17GT0SV3mnCi4Q==/3399689958447625.jpg?param=50y50");
//        comment.setNickName("Dannie__2");
//        comment.setContent("生活不会一直平顺，谁也不知道“走了岔路”，还能否“活着再见”。<br/>" +
//                "太多的火球会燃烧勇气、勤恳、执着与倔强；坚持自己的路上有太多寂寞孤单。<br/>" +
//                "不知道多少次青峰的某一句歌词拯救了在某个节点里被困住不前的我(们)。<br/>" +
//                "从此，我想成为自己，也成为他人的光。<br/>" +
//                "“让我们这些渺小的光…抵抗扛不动的寂寞");
//        comment.setCommentTime(new Date());
//        comment.setLikeNum(20686);
//        comments.add(comment);
//
//        comment = new Comment();
//        comment.setIcon("https://p1.music.126.net/BRe4cplDAxRNdEGas3Bttw==/109951163984175169.jpg?param=50y50");
//        comment.setNickName("bixxch");
//        comment.setContent("我是一个没有感情的吹峰机！");
//        comment.setCommentTime(new Date());
//        comment.setLikeNum(7834);
//        comments.add(comment);
//
//        return comments;
//    }
}
